//
//  nameController.m
//  TinyFortune
//
//  Created by lc on 16/5/26.
//  Copyright © 2016年 lc. All rights reserved.
//

#import "personMessageController.h"

@interface personMessageController ()<UITableViewDelegate,UITableViewDataSource>

@end

@implementation personMessageController


- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:_titleName];
    //设置navgationBar
    UIBarButtonItem *left = [[UIBarButtonItem alloc]initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(onClicked)];
    [self.navigationItem setLeftBarButtonItem:left];
    UIBarButtonItem *right = [[UIBarButtonItem alloc]initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(save)];
    [self.navigationItem setRightBarButtonItem:right];
    right.tintColor = [UIColor greenColor];
    
    self.navigationController.navigationBar.translucent = NO ;
    [self.navigationController setNavigationBarHidden:NO];
    [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:86/255.0f green:202/255.0f blue:255/255.0f alpha:0.5]];
    [self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    //添加滑动手势
    UISwipeGestureRecognizer *rightSwip = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(rightGo)];
    [self.view addGestureRecognizer:rightSwip];
    [rightSwip setDirection:UISwipeGestureRecognizerDirectionRight];
    //tableView
    self.tableView = [[UITableView alloc]init];
    self.tableView.translatesAutoresizingMaskIntoConstraints = NO;
    _tableView.delegate = self ;
    _tableView.dataSource = self ;
    __weak typeof(self)weakSelf = self ;
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(weakSelf.view);
    }];
    
    self.tableView.backgroundColor = [UIColor colorWithRed:239/255.0f green:239/255.0f blue:244/255.0f alpha:1];
    self.tableView.rowHeight = 30 ;

}
#pragma mark - 手势以及点击事件
- (void)rightGo{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)onClicked{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)save{
   
    
}
#pragma mark - 协议实现
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    }
    //输入框
   self.text = [[UITextField alloc]initWithFrame:cell.contentView.frame];
    [cell.contentView addSubview:self.text];
    self.text.translatesAutoresizingMaskIntoConstraints = NO;
    [self.text mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(cell.contentView);
    }];
    
    [self.text setClearButtonMode:UITextFieldViewModeAlways];
    return cell ;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return  1 ;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return  20.0f;
}

@end
